<template>
  <div>
    <table id="app" width="100%" border="0" cellpadding="0" cellspacing="1">
      <tbody>
      <tr>
        <td width="10%" align="center" valign="center" bgcolor="#fba661">编号</td>
        <td width="40%" align="center" valign="center" bgcolor="#fba661">项目名称
        </td>
        <td width="10%" align="center" valign="center" bgcolor="#fba661">申请人
        </td>
        <td width="20%" align="center" valign="center" bgcolor="#fba661">申报时间
        </td>
        <td width="10%" align="center" valign="center" bgcolor="#fba661">状态</td>
      </tr>
      <tr v-for="(project,i) in projects">
        <td align="center" valign="center" bgcolor="#f3f3f3">
          {{ project.projectId }}
        </td>
        <td align="center" valign="center" bgcolor="#f3f3f3">
          {{ project.projectName }}
        </td>
        <td align="center" valign="center" bgcolor="#f3f3f3">
          {{ project.applicant }}
        </td>
        <td align="center" valign="center" bgcolor="#f3f3f3">
          {{ project.fillData }}
        </td>
        <td align="center" valign="center" bgcolor="#f3f3f3"
            v-if="project.expertOpinion==null"><a href="viewprojectinfo.html"
                                                  @click.prevent="sendProjectId(i)">待审批</a>
        </td>
        <td align="center" valign="center" bgcolor="#f3f3f3" v-else="">已审批</td>
      </tr>
<!--      实验数据，仅有前端时需注释函数中的存储session id-->
<!--      <tr>-->
<!--        <td align="center" valign="center" bgcolor="#f3f3f3">0</td>-->
<!--        <td align="center" valign="center" bgcolor="#f3f3f3">ab</td>-->
<!--        <td align="center" valign="center" bgcolor="#f3f3f3">ab</td>-->
<!--        <td align="center" valign="center" bgcolor="#f3f3f3">2008-12-26</td>-->
<!--        <td align="center" valign="center" bgcolor="#f3f3f3">待审</td>-->
<!--        <td align="center" valign="center" bgcolor="#f3f3f3"><a href="viewprojectinfo.html"-->
<!--                                                                @click.prevent="sendProjectId(i)">待审批</a></td>-->
<!--      </tr>-->
      </tbody>
    </table>
  </div>

</template>

<script>
import four from '../../util/four';

export default {
  name: "showprojects.vue",
  data() {
    return {
      projects: [],
    }
  },
  mounted() {
    this.getByCid();
  },
  methods: {
    getByCid() {
      //获取cid
      let cid = JSON.parse(sessionStorage.getItem("cid"));
      four.get("/projectManage/getByCid/" + cid).then((res) => {
        this.projects = res.data.data;
      })
    },
    sendProjectId(i) {
      sessionStorage.setItem("projectId", JSON.stringify(this.projects[i].projectId));
      this.$router.push({
        path: '/expert/projectinfo'
      })
    }
  }
}
</script>

<style scoped>

</style>